﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security;
using webtracuudiem.Truyxuatdulieu;
using System.Web.Security;

namespace webtracuudiem
{
    public partial class quanlylophoc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButThemLop_Click(object sender, EventArgs e)
        {
            string malop,manganh, tenlop;
            malop = TextBox1.Text;
            manganh = DropDownList1.SelectedValue;
            tenlop = TextBox3.Text;
            string sql = "INSERT INTO lop VALUES('" + malop + "','" + manganh + "',N'" + tenlop + "')";
            TienIchSql.ChayLenhCapNhatDuLieu(sql);
            Response.Redirect(Request.RawUrl);
        }

        protected void ButCapnhat_Click(object sender, EventArgs e)
        {
            string malop, manganh, tenlop;
            malop = TextBox1.Text;
            manganh = DropDownList1.SelectedValue;
            tenlop = TextBox3.Text;
            string sql = "UPDATE lop SET tenlop='N" + tenlop + "', where malop='" + malop + "' and manganh='" + manganh + "'";
            TienIchSql.ChayLenhCapNhatDuLieu(sql);
            Response.Redirect(Request.RawUrl);
        }

        protected void ButThoat_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();
            Response.Redirect("/Default.aspx");
        }
    }
}